package service

import (
	"context"
	__ "user-srv/basic/proto"
	"user-srv/handler/dao"
)

// 收藏添加
func (s *Server) AddCollect(_ context.Context, in *__.AddCollectReq) (*__.AddCollectResp, error) {
	collect, err := dao.AddCollect(in)
	if err != nil {
		return nil, err
	}
	return &__.AddCollectResp{CollectId: int64(collect.Id)}, nil
}

// 收藏展示
func (s *Server) CollectInfo(_ context.Context, in *__.CollectInfoReq) (*__.CollectInfoResp, error) {
	info, err := dao.CollectInfo(in)
	if err != nil {
		return nil, err
	}
	return &__.CollectInfoResp{List: info}, nil
}

// 收藏删除
func (s *Server) DeleteCollect(_ context.Context, in *__.DeleteCollectReq) (*__.DeleteCollectResp, error) {
	collect, err := dao.DeleteCollect(in)
	if err != nil {
		return nil, err
	}
	return &__.DeleteCollectResp{Id: int64(collect.Id)}, nil
}
